-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix custom-formats with timezone #840
base: master
Are you sure you want to change the base?
Conversation
e9359fe
to
b3ab812
Compare
Codecov Report
@@ Coverage Diff @@
## master #840 +/- ##
=======================================
Coverage 98.33% 98.34%
=======================================
Files 231 231
Lines 2590 2594 +4
=======================================
+ Hits 2547 2551 +4
Misses 43 43
Continue to review full report at Codecov.
|
if ( | ||
not settings.RETURN_AS_TIMEZONE_AWARE | ||
or (settings.RETURN_AS_TIMEZONE_AWARE | ||
and 'default' == settings.RETURN_AS_TIMEZONE_AWARE and not is_originally_aware) | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💄
if ( | |
not settings.RETURN_AS_TIMEZONE_AWARE | |
or (settings.RETURN_AS_TIMEZONE_AWARE | |
and 'default' == settings.RETURN_AS_TIMEZONE_AWARE and not is_originally_aware) | |
): | |
if ( | |
not settings.RETURN_AS_TIMEZONE_AWARE | |
or ( | |
not is_originally_aware | |
and settings.RETURN_AS_TIMEZONE_AWARE == 'default' | |
) | |
): |
@@ -235,3 +242,15 @@ def setup_logging(): | |||
}, | |||
} | |||
logging.config.dictConfig(config) | |||
|
|||
|
|||
def is_aware(date_obj): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💄 is_tz_aware
or has_tz
?
self.then_date_was_parsed() | ||
self.then_parsed_period_is('day') | ||
self.then_parsed_date_is(expected_result) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these tests complete enough?
Given the changes I would expect a test where the date contains a timezone, settings specify a different timezone, and we check that the parsed timezone is the one from the input string, and not the one from the settings.
Also a test about the change to if settings.RETURN_AS_TIMEZONE_AWARE is not True:
.
Fix
ValueError
when parsing a date string that already contains timezone info with thecustom-formats
parser.fixes: #376, closes: #375